USE [NGroup.VTL.DB]
GO
/****** Object:  Table [dbo].[UserRoles]    Script Date: 12/23/2013 1:01:34 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[UserRoles](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Descriptions] [nvarchar](500) NOT NULL,
	[IsActive] [bit] NULL,
	[CreatedAt] [datetime] NULL,
	[CreatedBy] [nvarchar](50) NULL,
	[LastUpdatedAt] [datetime] NULL,
	[LastUpdatedBy] [nvarchar](50) NULL,
 CONSTRAINT [PK_UserRoles] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Users]    Script Date: 12/23/2013 1:01:34 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Users](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[RoleID] [int] NOT NULL,
	[Username] [nvarchar](50) NOT NULL,
	[Password] [nvarchar](200) NOT NULL,
	[UserAlias] [nvarchar](100) NULL,
	[IsActive] [bit] NULL,
	[CreatedAt] [datetime] NULL,
	[CreatedBy] [nvarchar](50) NULL,
	[LastUpdatedAt] [datetime] NULL,
	[LastUpdatedBy] [nvarchar](50) NULL,
 CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET IDENTITY_INSERT [dbo].[UserRoles] ON 

GO
INSERT [dbo].[UserRoles] ([ID], [Descriptions], [IsActive], [CreatedAt], [CreatedBy], [LastUpdatedAt], [LastUpdatedBy]) VALUES (1, N'System administrator', 1, CAST(0x0000A29C00000000 AS DateTime), N'Bui Thanh Nam', NULL, NULL)
GO
INSERT [dbo].[UserRoles] ([ID], [Descriptions], [IsActive], [CreatedAt], [CreatedBy], [LastUpdatedAt], [LastUpdatedBy]) VALUES (2, N'Administrator', 1, CAST(0x0000A29C00000000 AS DateTime), N'Bui Thanh Nam', NULL, NULL)
GO
SET IDENTITY_INSERT [dbo].[UserRoles] OFF
GO
SET IDENTITY_INSERT [dbo].[Users] ON 

GO
INSERT [dbo].[Users] ([ID], [RoleID], [Username], [Password], [UserAlias], [IsActive], [CreatedAt], [CreatedBy], [LastUpdatedAt], [LastUpdatedBy]) VALUES (1, 1, N'sa', N'vtl1234aa24/7', NULL, 1, NULL, NULL, NULL, NULL)
GO
INSERT [dbo].[Users] ( [RoleID], [Username], [Password], [UserAlias], [IsActive], [CreatedAt], [CreatedBy], [LastUpdatedAt], [LastUpdatedBy]) VALUES ( 2, N'vtladmin', N'vuaraoadmin', NULL, 1, NULL, NULL, NULL, NULL)
GO
SET IDENTITY_INSERT [dbo].[Users] OFF
GO
ALTER TABLE [dbo].[Users]  WITH CHECK ADD  CONSTRAINT [FK_Users_UserRoles] FOREIGN KEY([RoleID])
REFERENCES [dbo].[UserRoles] ([ID])
GO
ALTER TABLE [dbo].[Users] CHECK CONSTRAINT [FK_Users_UserRoles]
GO
